package com.project.logistics.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.logistics.bean.Repairs;
import com.project.logistics.bean.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by94988 on 2021/3/16 16:22
 */
//@Repository
@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Select("select * from user where user_id = #{userId}")
    User getUser(String userId);

    @Select("select * from repairs where repairs_user_id = #{userId}")
    List<Repairs> getRepairs(String userId);


    //我
    @Delete("delete from user where user_id = #{id}")
    boolean deleteUserById(String id);

    //
    @Select("select * from user where user_type = #{type}")
    List<User> getUserByType(int type);

    @Update("update user set password = '666' where user_id = #{userId}")
    int resetPassword(String userId);




    //根据userId修改password
    @Update("update user set password= #{newPassword} where user_id = #{userId}")
    void updatePassword(@Param("newPassword") String newPassword, @Param("userId") String userId);

}
